package br.com.rookgraph.heuristica;

import br.com.rookgraph.Edge;

public class Alterado implements Heuristica{

	@Override
	public Edge selectForCut(Edge candidate, Edge edgeCut) {

		if (edgeCut == null || candidate.alfa > edgeCut.alfa) {
			return candidate;
		} else if (candidate.alfa == edgeCut.alfa) {
			if(candidate.sigma < edgeCut.sigma){
				return candidate;
			}
		}

		return edgeCut;
	}

	@Override
	public Edge selectForRep(Edge candidate, Edge edgeRep) {
		if (edgeRep == null || candidate.alfa < edgeRep.alfa) {

			return candidate;

		} else if (candidate.alfa == edgeRep.alfa) {

			if(candidate.sigma > candidate.sigma){
				return candidate;
			}

		}
		return edgeRep;
	}

	@Override
	public boolean isVantajoso(Edge edgeRep, Edge edgeCut) {
		return (edgeRep.alfa < edgeCut.alfa) || (edgeRep.alfa == edgeCut.alfa && edgeRep.sigma > edgeCut.sigma);
	}

	@Override
	public boolean considerarArticulacoes() {
		return false;
	}
	
}
